<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>{% block title %}{% endblock %} - timeFlies</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="timeFlies">
    <meta name="description" content="timeFlies">
    <meta name="author" content="yinqi">
    <link href="{% static 'cms/css/bootstrap.min.css' %}" rel="stylesheet">
    <link href="{% static 'cms/css/materialdesignicons.min.css' %}" rel="stylesheet">
    <link href="{% static 'cms/css/animate.css' %}" rel="stylesheet">
    <link href="{% static 'cms/css/style.min.css' %}" rel="stylesheet">
    <style>
        #page-box a {
            cursor: pointer;
        }
    </style>
    {% block header %}

    {% endblock %}
</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">

            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a href="index.html"><img src="{% static 'cms/images/logo-sidebar.png' %}" title="dearknight"/></a>
            </div>
            <div class="lyear-layout-sidebar-scroll">

                <nav class="sidebar-main">
                    <ul class="nav nav-drawer">
                        <li class="nav-item"><a href="{% url 'cms:index' %}"><i class="mdi mdi-home"></i> 首页</a></li>
                        <li class="nav-item"><a href="{% url 'cms:focus' %}"><i class="mdi mdi-image-multiple"></i>
                            轮播</a>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-view-list"></i> 文章管理</a>
                            <ul class="nav nav-subnav">
                                <li><a href="{% url 'cms:posts_add' %}">文章发布</a></li>
                                <li><a href="{% url 'cms:posts' %}">文章列表</a></li>
                                <li><a href="{% url 'cms:posts_category' %}">文章分类</a></li>
                                <li><a href="{% url 'cms:posts_tag' %}">文章标签</a></li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-bullhorn"></i> 随说管理</a>
                            <ul class="nav nav-subnav">
                                <li><a href="{% url 'cms:talks_add' %}">写点什么</a></li>
                                <li><a href="{% url 'cms:talks' %}">随说列表</a></li>
                                <li><a href="{% url 'cms:talks_mood' %}">随说心情</a></li>
                            </ul>
                        </li>
                        <li class="nav-item nav-item-has-subnav">
                            <a href="javascript:void(0)"><i class="mdi mdi-account-settings-variant"></i> 用户管理</a>
                            <ul class="nav nav-subnav">
                                <li><a href="user-list.html">用户列表</a></li>
                            </ul>
                        </li>
                        <li class="nav-item"><a href="{% url 'cms:friends' %}"><i class="mdi mdi-account-multiple"></i> 友链管理</a></li>
                        <li class="nav-item"><a href="login.html"><i class="mdi mdi-login"></i> 登录</a></li>
                    </ul>
                </nav>

                <div class="sidebar-footer">
                    <!--    xxxxxxxxxx      -->
                </div>
            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                    </div>

                    <ul class="topbar-right">
                        <li class="dropdown dropdown-profile">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <img class="img-avatar img-avatar-48 m-r-10"
                                     src="{% static 'cms/images/users/avatar.jpg' %}" alt=""/>
                                <span>月黑风高夜 <span class="caret"></span></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li><a href="profile.html"><i class="mdi mdi-account"></i> 个人信息</a></li>
                                <li><a href="javascript:void(0)"><i class="mdi mdi-delete"></i> 清空缓存</a></li>
                                <li class="divider"></li>
                                <li><a href="{% url 'auth:logout' %}"><i class="mdi mdi-logout-variant"></i> 退出登录</a>
                                </li>
                            </ul>
                        </li>
                    </ul>

                </div>
            </nav>

        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">

            <div class="container-fluid">

                <!--  main  -->
                {% block main %}

                {% endblock %}
            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>
<!-- art-template  -->
{% verbatim %}
<script type="text/html" id="page-item">
    {{ if previous }}
    <li data-page="{{ page - 1 }}" title="{{ pages-1 }}"><a>«</a></li>
    {{ /if }}

    <% for(var i = 1; i <= pages; i++){ %>
    <li class="{{ i==page?'active disabled':'' }}" title="{{ i }}" data-page="{{ i==page?'':i }}"><a>{{i}}</a></li>
    <% } %>

    {{ if next }}
    <li data-page="{{ page + 1 }}" title="{{ pages+1 }}"><a>»</a></li>
    {{ /if }}
</script>
{% endverbatim %}

{% block utils %}

{% endblock %}
<script type="text/javascript" src="{% static 'cms/js/jquery.min.js' %}"></script>
<script type="text/javascript" src="{% static 'cms/js/bootstrap.min.js' %}"></script>
<script type="text/javascript" src="{% static 'cms/js/perfect-scrollbar.min.js' %}"></script>
<script type="text/javascript" src="{% static 'cms/js/main.min.js' %}"></script>

<script src="{% static 'cms/js/jquery.ajax.js' %}"></script>
<script src="{% static 'cms/js/bootstrap-notify.min.js' %}"></script>
<script src="{% static 'cms/js/lightyear.js' %}"></script>
<script src="{% static 'cms/js/template-web.js' %}"></script>

<script>
    // 导航切换
    $(function () {
        var cur_link = $('.nav-drawer a[href="' + location.pathname + '"]');
        var nav_item = cur_link.parents('.nav-item')
        if (nav_item.hasClass('nav-item-has-subnav')) { // 下拉
            nav_item.addClass('active open')
            cur_link.parent('li').addClass('active')
        } else {
            nav_item.addClass('active')
        }
    })

    function renderPage(res) {
        return template('page-item', {
            'pages': res.pages,
            'page': res.page,
            'next': res.next,
            'previous': res.previous,
        })
    }
    template.defaults.imports.timeSince = function (dateValue) {
        var date = new Date(dateValue);
        var year = date.getFullYear();
        var month = date.getMonth();
        var day = date.getDay();
        var hour = date.getHours();
        var minute = date.getMinutes();
        return year + '-' + month + '-' + day + " " + hour + ":" + minute;
    }

</script>
{% block footer %}

{% endblock %}
</body>
</html>